<!doctype html>



  


<html class="theme-next pisces use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.1" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Hexo, NexT" />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.1" />






<meta name="description" content="1、JVM内存区域与内存溢出1.1 JVM内存区域1.1.1 线程私有:(生命周期与线程相同)  Java虚拟机栈:每个方法会创建一个栈帧,栈帧在虚拟机入栈出栈过程代表方法执行开始到结束 本地方法栈:虚拟机需要用到Native方法 程序计数器:每个线程都有自己的程序计数器,用于CPU上下文切换时,记录执行了的字节码行号  1.1.2 线程共享:  方法区(永久代):虚拟机加载的类版本,字段,方法,">
<meta property="og:type" content="article">
<meta property="og:title" content="深入理解JVM">
<meta property="og:url" content="http://yoursite.com/2017/08/05/jvm/深入理解JVM/index.html">
<meta property="og:site_name" content="Tissan">
<meta property="og:description" content="1、JVM内存区域与内存溢出1.1 JVM内存区域1.1.1 线程私有:(生命周期与线程相同)  Java虚拟机栈:每个方法会创建一个栈帧,栈帧在虚拟机入栈出栈过程代表方法执行开始到结束 本地方法栈:虚拟机需要用到Native方法 程序计数器:每个线程都有自己的程序计数器,用于CPU上下文切换时,记录执行了的字节码行号  1.1.2 线程共享:  方法区(永久代):虚拟机加载的类版本,字段,方法,">
<meta property="og:updated_time" content="2018-03-06T11:11:26.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="深入理解JVM">
<meta name="twitter:description" content="1、JVM内存区域与内存溢出1.1 JVM内存区域1.1.1 线程私有:(生命周期与线程相同)  Java虚拟机栈:每个方法会创建一个栈帧,栈帧在虚拟机入栈出栈过程代表方法执行开始到结束 本地方法栈:虚拟机需要用到Native方法 程序计数器:每个线程都有自己的程序计数器,用于CPU上下文切换时,记录执行了的字节码行号  1.1.2 线程共享:  方法区(永久代):虚拟机加载的类版本,字段,方法,">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: 'undefined',
      author: 'Java程序员'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/2017/08/05/jvm/深入理解JVM/"/>





  <title>深入理解JVM | Tissan</title>
  














</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Tissan</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2017/08/05/jvm/深入理解JVM/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="罗天翔">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/uploads/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Tissan">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">深入理解JVM</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-08-05T21:12:09+08:00">
                2017-08-05
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/JVM/" itemprop="url" rel="index">
                    <span itemprop="name">JVM</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
              <span class="post-meta-divider">|</span>
              <span class="post-meta-item-icon">
                <i class="fa fa-comment-o"></i>
              </span>
              
                <a href="/2017/08/05/jvm/深入理解JVM/#SOHUCS" itemprop="discussionUrl">
                  <span id="changyan_count_unit" class="post-comments-count hc-comment-count" data-xid="2017/08/05/jvm/深入理解JVM/" itemprop="commentsCount"></span>
                </a>
              
            
          

          
          

          

          

          

        </div>
      </header>
    

    <div class="post-body" itemprop="articleBody">

      
      

      
        <h3 id="1、JVM内存区域与内存溢出"><a href="#1、JVM内存区域与内存溢出" class="headerlink" title="1、JVM内存区域与内存溢出"></a>1、JVM内存区域与内存溢出</h3><h4 id="1-1-JVM内存区域"><a href="#1-1-JVM内存区域" class="headerlink" title="1.1 JVM内存区域"></a>1.1 JVM内存区域</h4><p>1.1.1 线程私有:(生命周期与线程相同)</p>
<ul>
<li>Java虚拟机栈:每个方法会创建一个栈帧,栈帧在虚拟机入栈出栈过程代表方法执行开始到结束</li>
<li>本地方法栈:虚拟机需要用到Native方法</li>
<li>程序计数器:每个线程都有自己的程序计数器,用于CPU上下文切换时,记录执行了的字节码行号</li>
</ul>
<p>1.1.2 线程共享:</p>
<ul>
<li>方法区(<strong>永久代</strong>):虚拟机加载的类版本,字段,方法,接口<ul>
<li>运行时常量池:编译期产生的字面量和符号引用,直接引用(类加载后)–类加载机制</li>
</ul>
</li>
<li>堆:存放对象的实例<ul>
<li>新生代:<ul>
<li>Eden(80%):对象存放位置</li>
<li>From Survivor(10%):gc后将Eden存活对象复制到这</li>
<li>To Survivor(10%):gc后From存活对象复制到这</li>
</ul>
</li>
<li>老年代:进入条件<ul>
<li>多次gc后(default=15)进入老年代(-XX:MaxTenuringThreshold=?)</li>
<li>Survivor空间相同年龄对象大小总和&gt;Survivor空间一半</li>
</ul>
</li>
<li>多个线程私有的分配缓冲区(TLAB)</li>
</ul>
</li>
<li>直接内存:基于通道Channel和缓冲区Buffer的I/O技术,使用Native函数分配堆外内存,这个是NIO需要使用<blockquote>
<p>堆分配控制:-Xmx -Xms<br>无法继续扩展将会抛出:OutOfMemoryError</p>
</blockquote>
</li>
</ul>
<h4 id="1-2-对象存储"><a href="#1-2-对象存储" class="headerlink" title="1.2 对象存储"></a>1.2 对象存储</h4><p>1.2.1 对象结构:</p>
<ul>
<li>对象头<strong>Mark Word</strong>:HashCode,GC分代年龄,锁状态标志,线程持有锁,偏向线程ID</li>
<li>实例数据:</li>
<li>对齐填充:</li>
</ul>
<blockquote>
<p>数组的对象头要存储数组的长度</p>
</blockquote>
<p>1.2.2 对象访问:</p>
<ul>
<li>使用<strong>栈上的reference数据</strong>来操作堆上的具体对象<ul>
<li><em>如果使用句柄访问,Java堆会划分一块内存来作为句柄池,reference存储的就是对象的句柄地址</em></li>
<li><em>如果直接指针访问,reference存储的直接就是对象地址</em></li>
</ul>
</li>
</ul>
<blockquote>
<p>句柄的好处:就是对象地址改动,只需update句柄数据,不用改动reference<br>直接指针访问:速度快就减少时间开销</p>
</blockquote>
<h4 id="1-3-存储常见问题"><a href="#1-3-存储常见问题" class="headerlink" title="1.3 存储常见问题"></a>1.3 存储常见问题</h4><p>1.3.1 堆:</p>
<blockquote>
<p>技术点: VM args,Java Heap Space, -XX:+HeapDumpOnOutOfMemoryError</p>
</blockquote>
<ol>
<li><p>OutOfMemoryError:扩展堆无法请求到足够的内存</p>
<ul>
<li>PermGen Space<em>永久代</em>(-XX:MaxPermSize): 运行时常量池错误</li>
</ul>
</li>
<li><p>Memory Leak:线程请求的栈深度大于虚拟机允许的最大深度<br>1.3.2 栈:</p>
<blockquote>
<p>Xss(栈容量)</p>
</blockquote>
</li>
<li><p>StackOverflowError:</p>
</li>
</ol>
<p>1.3.3 方法区和运行时常量池:</p>
<ul>
<li>PermGen Space (方法区:HotSpot虚拟机中的永久代)</li>
<li>CGLib直接操作字节码产生类</li>
</ul>
<h3 id="2、垃圾收集器与内存分配策略"><a href="#2、垃圾收集器与内存分配策略" class="headerlink" title="2、垃圾收集器与内存分配策略"></a>2、垃圾收集器与内存分配策略</h3><h4 id="2-1-判断对象是否存活"><a href="#2-1-判断对象是否存活" class="headerlink" title="2.1 判断对象是否存活"></a>2.1 判断对象是否存活</h4><ul>
<li>引用计数器: 有地方引用obj就+1<em>互相引用事实上都有没有被用</em></li>
<li>可达性算法: 虚拟机栈/类静态属性/方法区常量/本地方法栈 引用的对象</li>
</ul>
<h4 id="2-2-引用"><a href="#2-2-引用" class="headerlink" title="2.2 引用"></a>2.2 引用</h4><blockquote>
<p>强引用:Object obj = new Object(); 这类引用永远不会被垃圾收集器回收掉<br>软引用:SoftReference内存不够准备抛出outOfMemory时,会清理软引用,再看是否需要抛出异常<br>弱引用:WeakReference来实现对象会直接被gc掉(无论内存是否足够)  // ThreadLocal使用的key是弱引用<br>虚引用:PhantomReference来实现对象被gc前收到系统通知</p>
</blockquote>
<p>finalize: 第一次会加入F-Queue队列,如果第二次gc前被引用即可逃离死亡</p>
<h4 id="2-3-回收方法区"><a href="#2-3-回收方法区" class="headerlink" title="2.3 回收方法区"></a>2.3 回收方法区</h4><p>1.没有任何String对象引用常量池的”abc”常量,abc在常量池就会被回收<br>2.类被回收:类的所有实例被回收/ClassLoader被回收/该类对象没有被引用</p>
<h4 id="2-4-垃圾回收算法"><a href="#2-4-垃圾回收算法" class="headerlink" title="2.4 垃圾回收算法"></a>2.4 垃圾回收算法</h4><blockquote>
<p>标记-清除算法:效率不高,产生大量的碎片<br>复制算法:将内存拆分,gc后将存活的对象都复制到一块,防止内存碎片<br>标记-整理算法:将标记都清楚然后将存活对象都移到一端<br>分代收集算法:新生代/老年代</p>
</blockquote>
<h4 id="2-5-垃圾回收器Garbage-Collector"><a href="#2-5-垃圾回收器Garbage-Collector" class="headerlink" title="2.5 垃圾回收器Garbage Collector"></a>2.5 垃圾回收器Garbage Collector</h4><p>新生代收集器:<br>1.Serial收集器:单线程串行收集器效率低<br>2.ParNew收集器:相当于多线程的Serial<br>3.Parallel Scavenge回收器(Java8默认):采用复制算法,设置-XX:MaxGCPauseMillis,-XX:GCTimeRatio参数<br>老年代收集器:<br>4.CMS收集器:最短停顿时间 BUT!</p>
<ul>
<li>CMS对CPU资源敏感:占用CPU资源导致程序变慢</li>
<li>无法处理浮动垃圾</li>
<li>基于标记-清除会产生大量的内存碎片<br>5.Serial Old收集器:Serial的老年代版本还是挺好用的<br>6.Parallel Old:针对老年代性能好<br>7.G1垃圾回收器 <code>-XX:UseG1GC</code></li>
</ul>
<ul>
<li>并行与并发:多CPU情况,GC操作情况下依旧可以运行Java程序</li>
<li>分代收集:采用不同的方式管理不同区</li>
<li>空间整合:复制算法防止gc产生碎片</li>
<li>可预测的停顿</li>
</ul>
<p><strong>项目中gc日志:</strong><br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">109104.449: [Full GC [PSYoungGen: 703854K-&gt;0K(2413056K)] [ParOldGen: 1144802K-&gt;978243K(4000256K)] 1848656K-&gt;978243K(6413312K) [PSPermGen: 67548K-&gt;67456K(131072K)], 0.6693850 secs] [Times: user=1.91 sys=0.01, real=0.67 secs]</div><div class="line">112705.769: [Full GC [PSYoungGen: 582823K-&gt;0K(2330624K)] [ParOldGen: 1576676K-&gt;922982K(4000256K)] 2159500K-&gt;922982K(6330880K) [PSPermGen: 67460K-&gt;67460K(131072K)], 0.8440820 secs] [Times: user=2.65 sys=0.00, real=0.85 secs]</div><div class="line">116307.976: [Full GC [PSYoungGen: 11248K-&gt;0K(1274880K)] [ParOldGen: 1819479K-&gt;288012K(4000256K)] 1830728K-&gt;288012K(5275136K) [PSPermGen: 67464K-&gt;67464K(131072K)], 0.9334330 secs] [Times: user=2.48 sys=0.02, real=0.94 secs]</div><div class="line">119909.921: [Full GC [PSYoungGen: 25872K-&gt;0K(3238912K)] [ParOldGen: 1456779K-&gt;321347K(4000256K)] 1482651K-&gt;321347K(7239168K) [PSPermGen: 67987K-&gt;67894K(131072K)], 1.5040210 secs] [Times: user=4.38 sys=0.02, real=1.51 secs]</div></pre></td></tr></table></figure></p>
<p><code>109104.449</code>:从Java虚拟机启动以来发生的秒数<br><code>Full GC</code>:Stop The World<br><code>PSYoungGen、ParOldGen、PSPermGen</code>属于Parallel收集器</p>
<ul>
<li>PSYoungGen:看的出来<code>Full GC</code>是直接将新生代清空</li>
<li>ParOldGen:老年代gc掉20%</li>
<li>PSPermGen:方法区(永久代)基本上不gc掉类信息</li>
</ul>
<p>新生代:Minor GC频繁发生,回收速度快<br>老年代:Full GC/Major GC</p>
<p>策略:<br>1.-XX:PretenureSizeThreshold:设置的对象直接在年老代分配,防止对象哎Eden和两个Survivor产生大量的内存复制<br>ParNew+CMS组合使用这个参数<br>2.注重吞吐量以及CPU资源敏感:Parallel Scavenge+Parallel Old组合收集器<br>3.新生代避免设置过小:minorGC频繁,导致对象直接分配到老年代,所以会触发fullGC;<br>4.新生代避免设置过大:minorGC时间长,导致老年代比较小,会触发fullGC;</p>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        
  <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
    <div>坚持原创技术分享，您的支持将鼓励我继续创作！</div>
    <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
      <span>赏</span>
    </button>
    <div id="QR" style="display: none;">
      
        <div id="wechat" style="display: inline-block">
          <img id="wechat_qr" src="/uploads/wechat.png" alt="罗天翔 WeChat Pay"/>
          <p>微信打赏</p>
        </div>
      
      
        <div id="alipay" style="display: inline-block">
          <img id="alipay_qr" src="/uploads/ali.jpg" alt="罗天翔 Alipay"/>
          <p>支付宝打赏</p>
        </div>
      
    </div>
  </div>


      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/07/25/java/回调机制/" rel="next" title="回调机制">
                <i class="fa fa-chevron-left"></i> 回调机制
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/08/17/zookeeper/zookeeper的watcher机制/" rel="prev" title="zookeeper的watcher机制">
                zookeeper的watcher机制 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div id="SOHUCS"></div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/uploads/avatar.jpg"
               alt="罗天翔" />
          <p class="site-author-name" itemprop="name">罗天翔</p>
           
              <p class="site-description motion-element" itemprop="description">一次就把事情做对.</p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/archives/">
                <span class="site-state-item-count">74</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-categories">
              <a href="/categories/index.html">
                <span class="site-state-item-count">15</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/louiegit/" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="" target="_blank" title="微信">
                  
                    <i class="fa fa-fw fa-wechat"></i>
                  
                  微信
                </a>
              </span>
            
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#1、JVM内存区域与内存溢出"><span class="nav-number">1.</span> <span class="nav-text">1、JVM内存区域与内存溢出</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#1-1-JVM内存区域"><span class="nav-number">1.1.</span> <span class="nav-text">1.1 JVM内存区域</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#1-2-对象存储"><span class="nav-number">1.2.</span> <span class="nav-text">1.2 对象存储</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#1-3-存储常见问题"><span class="nav-number">1.3.</span> <span class="nav-text">1.3 存储常见问题</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2、垃圾收集器与内存分配策略"><span class="nav-number">2.</span> <span class="nav-text">2、垃圾收集器与内存分配策略</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#2-1-判断对象是否存活"><span class="nav-number">2.1.</span> <span class="nav-text">2.1 判断对象是否存活</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-2-引用"><span class="nav-number">2.2.</span> <span class="nav-text">2.2 引用</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-3-回收方法区"><span class="nav-number">2.3.</span> <span class="nav-text">2.3 回收方法区</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-4-垃圾回收算法"><span class="nav-number">2.4.</span> <span class="nav-text">2.4 垃圾回收算法</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-5-垃圾回收器Garbage-Collector"><span class="nav-number">2.5.</span> <span class="nav-text">2.5 垃圾回收器Garbage Collector</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2018</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">罗天翔</span>
</div>


<div class="powered-by">
  NBA & Code. What?
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Pisces
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.1"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.1"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.1"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.1"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.1"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.1"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.1"></script>



  


  




	





  





  





  




  
    <script type="text/javascript">
    (function(){
      var appid = 'cyt9ceIwz';
      var conf = 'c6226e2bfb7e9c65efc235736edc5074';
      var width = window.innerWidth || document.documentElement.clientWidth;
      if (width < 960) {
      window.document.write('<script id="changyan_mobile_js" charset="utf-8" type="text/javascript" src="https://changyan.sohu.com/upload/mobile/wap-js/changyan_mobile.js?client_id=' + appid + '&conf=' + conf + '"><\/script>'); } else { var loadJs=function(d,a){var c=document.getElementsByTagName("head")[0]||document.head||document.documentElement;var b=document.createElement("script");b.setAttribute("type","text/javascript");b.setAttribute("charset","UTF-8");b.setAttribute("src",d);if(typeof a==="function"){if(window.attachEvent){b.onreadystatechange=function(){var e=b.readyState;if(e==="loaded"||e==="complete"){b.onreadystatechange=null;a()}}}else{b.onload=a}}c.appendChild(b)};loadJs("https://changyan.sohu.com/upload/changyan.js",function(){
        window.changyan.api.config({appid:appid,conf:conf})});
      }
    })();
    </script>
    <script type="text/javascript" src="https://assets.changyan.sohu.com/upload/plugins/plugins.count.js"></script>
  




  





  

  

  

  

  

  

</body>
</html>
